package com.zycfc.zsf.boot.logback.core;

import java.io.*;
import com.zycfc.zsf.boot.util.text.*;
import com.zycfc.zsf.boot.logback.consts.*;
import java.util.*;
import com.zycfc.zsf.boot.util.time.*;
import java.time.*;
import java.time.format.*;

public class FileMonitorStepBuilder implements Serializable
{
    private static final long serialVersionUID = 1L;
    private String flowId;
    private String bizNo;
    private String fileNo;
    private String exeType;
    private String exeSts;
    private String startTime;
    private String description;
    
    public FileMonitorStepBuilder() {
        this.exeSts = "S";
    }
    
    public FileMonitorStepBuilder setFlowId(String flowId) {
        if (StringUtils.isBlank((CharSequence)flowId)) {
            flowId = null;
        }
        this.flowId = flowId;
        return this;
    }
    
    public FileMonitorStepBuilder setBizNo(String bizNo) {
        if (StringUtils.isBlank((CharSequence)bizNo)) {
            bizNo = null;
        }
        this.bizNo = bizNo;
        return this;
    }
    
    public FileMonitorStepBuilder setFileNo(String fileNo) {
        if (StringUtils.isBlank((CharSequence)fileNo)) {
            fileNo = null;
        }
        this.fileNo = fileNo;
        return this;
    }
    
    public FileMonitorStepBuilder setExeType(final FileStepExeTypeEnum fileStepExeTypeEnum) {
        this.exeType = fileStepExeTypeEnum.getCode();
        return this;
    }
    
    public FileMonitorStepBuilder setExeStsSucc() {
        this.exeSts = "S";
        return this;
    }
    
    public FileMonitorStepBuilder setExeStsFail() {
        this.exeSts = "F";
        return this;
    }
    
    public FileMonitorStepBuilder setStartTime(final Date startTime) {
        this.startTime = DateUtils.DEFAULT_ON_SECOND_FORMAT.format(startTime);
        return this;
    }
    
    public FileMonitorStepBuilder setStartTime(final LocalDateTime startTime) {
        this.startTime = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        return this;
    }
    
    public FileMonitorStepBuilder setDescription(String description) {
        if (StringUtils.isNotBlank((CharSequence)description)) {
            if (description.length() >= 2000) {
                description = description.substring(0, 2000);
            }
        }
        else {
            description = null;
        }
        this.description = description;
        return this;
    }
    
    public FileMonitorStep build() {
        return new FileMonitorStep(this);
    }
    
    public String getFlowId() {
        return this.flowId;
    }
    
    public String getBizNo() {
        return this.bizNo;
    }
    
    public String getFileNo() {
        return this.fileNo;
    }
    
    public String getExeType() {
        return this.exeType;
    }
    
    public String getExeSts() {
        return this.exeSts;
    }
    
    public String getStartTime() {
        return this.startTime;
    }
    
    public String getDescription() {
        return this.description;
    }
}
